package org.example.service.Impl;

import cn.hutool.core.net.multipart.UploadFile;
import cn.hutool.poi.excel.ExcelUtil;
import org.example.config.R;
import org.example.domain.Deposits;
import org.example.domain.DepositsUnit;
import org.example.domain.DepositsVo;
import org.example.mapper.DepositUnitMapper;
import org.example.mapper.DepositsMapper;
import org.example.service.DepositsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Service
public class DepositsServiceImpl implements DepositsService {
    @Autowired
    DepositsMapper depositsMapper;
    @Override
    public List<Deposits> depositsList(DepositsVo depositsVo) {
        return depositsMapper.depositsList(depositsVo);
    }

    @Override
    public List<Deposits> stashByIdAndTitleAndStatus(Deposits deposits,Integer id) {
        return depositsMapper.stashByIdAndTitleAndStatus(deposits,id);
    }

    @Override
    public List<Deposits> depositsName(Integer depositId) {
        return depositsMapper.depositsName(depositId);
    }

    @Override
    public R depositsAdd(Deposits deposits) {
        depositsMapper.depositsAdd(deposits);
        return R.successed(null);
    }

    @Override
    public R delById(Integer id) {
        depositsMapper.delById(id);
        return R.successed(null);
    }

    @Override
    public R updateDeposits(Deposits deposits) {
        Integer integer = depositsMapper.updateDeposits(deposits);
        if(integer>0){
            return R.successed(null);
        }else{
            return R.failed("请求失败，请刷新，若还是不行，请联系管理员");
        }
    }

    @Override
    public List<Deposits> list() {
        return depositsMapper.list();
    }

}
